home *** CD-ROM | disk | FTP | other *** search
/ Complete Linux / Complete Linux.iso / docs / apps / database / ingres04.lzh / source / qrymod / issue.c < prev    next >
Encoding:
C/C++ Source or Header  |  1985-01-23  |  1.6 KB  |  88 lines

  1. # include    <ingres.h>
  2. # include    <aux.h>
  3. # include    <symbol.h>
  4. # include    <tree.h>
  5. # include    <pv.h>
  6. # include    "qrymod.h"
  7. # include    <sccs.h>
  8.  
  9. SCCSID(@(#)issue.c    8.1    12/31/84)
  10.  
  11. /*
  12. **  ISSUE -- issue query to rest of system
  13. **
  14. **    This function issues a query to the rest of the INGRES system.
  15. **    The sync from below is read, but not passed up.
  16. **
  17. **    Parameters:
  18. **        tree -- pointer to tree to issue.
  19. **
  20. **    Returns:
  21. **        none.
  22. **
  23. **    Side Effects:
  24. **        A query is executed.
  25. **
  26. **    Trace Flags:
  27. **        71
  28. */
  29.  
  30. issue(state, tree)
  31. int    state;
  32. QTREE    *tree;
  33. {
  34. #    ifdef xQTR2
  35.     if (tTf(71, 0))
  36.         printf("issue:\n");
  37. #    endif
  38.  
  39.     initp();
  40.     setp(PV_QTREE, tree, 0);
  41.     call(state, NULL);
  42. }
  43. /*
  44. **  ISSUEINVERT -- issue a query, but invert the qualification
  45. **
  46. **    This routine is similar to 'issue', except that it issues
  47. **    a query with the qualification inverted.  The inversion
  48. **    (and subsequent tree normalization) is done on a duplicate
  49. **    of the tree.
  50. **
  51. **    Parameters:
  52. **        root -- the root of the tree to issue.
  53. **
  54. **    Returns:
  55. **        none.
  56. **
  57. **    Side Effects:
  58. **        'root' is issued.
  59. **
  60. **    Trace Flags:
  61. **        none
  62. */
  63.  
  64. issueinvert(root)
  65. QTREE    *root;
  66. {
  67.     register QTREE    *t;
  68.     register QTREE    *uop;
  69.     extern QTREE    *treedup();
  70.     extern QTREE    *trimqlend(), *norml();
  71.  
  72.     /* make duplicate of tree */
  73.     t = treedup(root);
  74.  
  75.     /* prepend NOT node to qualification */
  76.     uop = (QTREE *) need(Qbuf, QT_HDR_SIZ + sizeof(short));
  77.     uop->left = NULL;
  78.     uop->right = t->right;
  79.     uop->sym.type = UOP;
  80.     uop->sym.len = sizeof(short);
  81.     uop->sym.value.sym_op.opno = opNOT;
  82.     t->right = uop;
  83.  
  84.     /* normalize and issue */
  85.     t->right = norml(trimqlend(t->right));
  86.     issue(mdQRY, t);
  87. }
  88.